//
//  BBQuestionViewController.swift
//  BBLinkiOSProject
//
//  Created by liuzhu on 2018/12/18.
//  Copyright © 2018 liuzhu. All rights reserved.
//

import UIKit

let BBQuestionIdentifier = "BBQuestionReuseIdentifier"
class BBQuestionViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(tableView)
        tableView.register(BBHelpCell.self, forCellReuseIdentifier: BBQuestionIdentifier)
    }
    
    
    private lazy var tableView: UITableView = {
        let tableView = UITableView(frame: UIScreen.main.bounds)
        tableView.estimatedRowHeight = 210
        tableView.rowHeight = UITableView.automaticDimension
        tableView.separatorStyle = .none
        tableView.dataSource = self
        tableView.delegate = self
        return tableView
    }()
}

extension BBQuestionViewController:UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 4
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: BBQuestionIdentifier, for: indexPath) as! BBHelpCell
        if indexPath.row == 0 {
            cell.titleLabel.text = "Why is there no data on my home page?"
            cell.contentLabel.text = "The front page shows your riding data, including track, speed, time, etc. You will need to ride at a distance of more than 100m (), APP) to get the data for display."
        }else if(indexPath.row == 1){
            cell.titleLabel.text = "Why can't I change the car?"
            cell.contentLabel.text = "The vehicles displayed on the personal page are bound according to your invitation code. After you purchase the vehicle, we will assign you an invitation code corresponding to the vehicle. When you register with the invitation code, your vehicle will be displayed on the personal page. This vehicle can not be changed for the time being, and the system will be upgraded later, which will add the function of changing the vehicle."
        }else if(indexPath.row == 2){
            cell.titleLabel.text = "What is \"Click\""
            cell.contentLabel.text = "When you click on \"Click\" ,APP aggregates your day's data and allows you to take a picture and write a paragraph. To sum up your achievements of the day. You can also share it on the link page, others will see it, and maybe they will like it for you."
        }else{
            cell.titleLabel.text = "My biking data is not accurate."
            cell.contentLabel.text = "In this release, we don't let APP always get your location, but only when you get to the cycling page. So, when you go to the biking page and click the start button. The phone will capture your location in real time and calculate your riding data. At this point, it's best not to switch the APP to the background, but to let the APP stay on the page all the time. Because once you exit the APP, we will not be able to get your location information, which will cause us to get inaccurate data, when the end of the ride, you can arbitrarily close the APP."
        }
        return cell
    }
}
